<div class="layui-card">
    <div class="layui-card-header layuiadmin-card-header-auto">
        <h2>添加备注</h2>
        <div class="layui-btn-container">
            <a href="<?php echo \yii\helpers\Url::to(['index']); ?>" class="layui-btn layui-btn-sm layui-btn-primary"><i class="layui-icon layui-icon-left"></i>返回列表</a>
            <a href="<?php echo \yii\helpers\Url::to(['show','id'=>$model->id]); ?>" class="layui-btn layui-btn-sm"><i class="layui-icon layui-icon-template"></i>项目详情</a>
            <a href="<?php echo \yii\helpers\Url::to(['node','id'=>$model->id]); ?>" class="layui-btn layui-btn-sm layui-btn-normal"><i class="layui-icon layui-icon-engine"></i>更新节点</a>
            <a href="<?php echo \yii\helpers\Url::to(['remark','id'=>$model->id]); ?>" class="layui-btn layui-btn-sm layui-btn-normal"><i class="layui-icon layui-icon-form"></i>添加备注</a>
            <a id="destroyBtn" data-url="<?php echo \yii\helpers\Url::to(['destroy','id'=>$model->id]); ?>" class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon layui-icon-delete"></i>删除</a>
        </div>
    </div>
    <div class="layui-card-body">
        <form class="layui-form" action="<?php echo \yii\helpers\Url::to(['remark','id'=>$model->id])?>" method="post">
            <div class="layui-form-item">
                <label for="" class="layui-form-label">备注内容</label>
                <div class="layui-input-inline">
                    <textarea name="content" class="layui-textarea" lay-verify="required"></textarea>
                </div>
                <div class="layui-word-aux layui-form-mid"><?php echo $form->getFirstError('content'); ?></div>
            </div>
            <div class="layui-form-item">
                <label for="" class="layui-form-label">下次跟进</label>
                <div class="layui-input-inline">
                    <input type="text" id="next_follow_at" name="next_follow_at" placeholder="请选择时间" lay-verify="required" readonly class="layui-input">
                </div>
                <div class="layui-word-aux layui-form-mid"><?php echo $form->getFirstError('next_follow_at'); ?></div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button type="submit" lay-submit class="layui-btn">确认</button>
                    <a href="<?php echo \yii\helpers\Url::to(['index']); ?>" class="layui-btn layui-btn-primary">返回</a>
                </div>
            </div>
        </form>
    </div>
</div>


<?php
$index_url = \yii\helpers\Url::to(['index']);
$js = <<<JS
    layui.use(['form','element','table', 'layer','laydate'],function() {
        var form = layui.form;  
        var element = layui.element;  
        var table = layui.table;  
        var layer = layui.layer;  
        var laydate = layui.laydate;
        
        laydate.render({
            elem: '#next_follow_at',
            type: 'datetime'
        })
        
        $("#destroyBtn").click(function() {
            var url = $(this).data('url')
            layer.confirm('确认删除吗？', function(index){
                $.post(url,{},function(res) {
                    layer.msg(res.msg,{},function() {
                        if (res.code==0){
                            location.href = '{$index_url}'
                        }   
                    })  
                })
            });  
        })
        
    });
JS;
$this->registerJs($js);
